home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes ƒ / Halves scroll.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  1.7 KB  |  53 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define CorrectTime 3
  4. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  5. #define theWindowWidth (boundsRect.right-boundsRect.left)
  6.  
  7. pascal short HalvesScroll(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  8.  
  9. /* 2 regions, split down the middle of the screen.  Scroll the screen up in one
  10.    region and down in the other. */
  11.    
  12. pascal short HalvesScroll(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  13. {
  14.     short            x;
  15.     Rect        theTopRect, topdest, theBottomRect, bottomdest;
  16.     Rect        topscrollsource, bottomscrollsource;
  17.     short            cx;
  18.     short            BoxSize;
  19.     
  20.     BoxSize=theWindowHeight/25;
  21.     cx = boundsRect.left + theWindowWidth / 2;
  22.  
  23.     topscrollsource=topdest=bottomscrollsource=bottomdest=boundsRect;
  24.     topscrollsource.right=topdest.right=bottomscrollsource.left=bottomdest.left=cx;
  25.     topdest.bottom=topdest.top+BoxSize;
  26.     bottomdest.top=bottomdest.bottom-BoxSize;
  27.     SetRect(&theTopRect, boundsRect.left, boundsRect.bottom-BoxSize, cx, boundsRect.bottom);
  28.     SetRect(&theBottomRect, cx, boundsRect.top, boundsRect.right, boundsRect.top+BoxSize);
  29.     
  30.     for(x = theWindowHeight - BoxSize; x >= 0; x -= BoxSize)
  31.     {
  32.         StartTiming();
  33.         ScrollTheRect(&topscrollsource, 0, BoxSize, 0L);
  34.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  35.                 &theTopRect, &topdest, 0, 0L);
  36.         theTopRect.bottom-=BoxSize;
  37.         theTopRect.top-=BoxSize;
  38.         
  39.         ScrollTheRect(&bottomscrollsource, 0, -BoxSize, 0L);
  40.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  41.                 &theBottomRect, &bottomdest, 0, 0L);
  42.         theBottomRect.top+=BoxSize;
  43.         theBottomRect.bottom+=BoxSize;
  44.         
  45.         TimeCorrection(CorrectTime);
  46.     }
  47.     
  48.     CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  49.         &boundsRect, &boundsRect, 0, 0L);
  50.     
  51.     return 0;
  52. }
  53.